package com.huike.clues.service.impl;


import com.huike.clues.domain.TbAssignRecord;
import com.huike.clues.domain.TbClue;
import com.huike.clues.domain.TbClueTrackRecord;
import com.huike.clues.domain.vo.ClueTrackRecordVo;
import com.huike.clues.mapper.TbClueMapper;
import com.huike.clues.mapper.TbClueTrackRecordMapper;
import com.huike.clues.service.ITbClueTrackRecordService;
import com.huike.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 线索跟进记录Service业务层处理
 * @date 2022-04-22
 */
@Service
public class TbClueTrackRecordServiceImpl implements ITbClueTrackRecordService {


    @Autowired
    private TbClueTrackRecordMapper tbClueTrackRecordMapper;

    @Autowired
    private TbClueMapper tbClueMapper;


    @Override
    public void add(TbClueTrackRecord tbClueTrackRecord, TbClue tbClue) {

        // 向线索表跟进记录表 保存记录
        tbClueTrackRecordMapper.insert(tbClueTrackRecord);

        //向线索表更新数据
        tbClueMapper.updateTbClue(tbClue);



//        //构建对象
//        TbClueTrackRecord tbClueTrackRecord = new TbClueTrackRecord();
//
//        //封装属性       gsdsgdsgdsgw
//       tbClueTrackRecord.setId(tbClueTrackRecord.getId());
//        tbClueTrackRecord.setClueId(clueTrackRecordVo.getClueId());
//        tbClueTrackRecord.setLevel(clueTrackRecordVo.getLevel());
//        tbClueTrackRecord.setSubject(clueTrackRecordVo.getSubject());
//        tbClueTrackRecord.setRecord(clueTrackRecordVo.getRecord());
//        tbClueTrackRecord.setNextTime(clueTrackRecordVo.getNextTime());
//        tbClueTrackRecord.setCreateBy(clueTrackRecordVo.getName());
//        tbClueTrackRecord.setCreateTime(DateUtils.getNowDate());
//        tbClueTrackRecord.setType(clueTrackRecordVo.getType());
//        tbClueTrackRecord.setFalseReason(clueTrackRecordVo.getFalseReason());
//
//        //调用mapper新增
//        int rows = tbClueTrackRecordMapper.insertTbClueTrackRecord(clueTrackRecordVo);
//
//        return rows ;

    }

    @Override
    public List<TbClueTrackRecord> findListByClueId(Long clueId) {
        return tbClueTrackRecordMapper.findListByClueId(clueId);
    }
}
